﻿<%@ Page Language="C#" MasterPageFile="~/Masters/AdminSchedule.master" AutoEventWireup="true" CodeFile="TripEdit.aspx.cs"
	 Inherits="Pages_Carrier_TripEdit" Title="Редактирование рейса" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cphHead" Runat="Server">
	<link rel="stylesheet" type="text/css" media="screen" href="../../styles/EntityEditStyle.css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphContent" Runat="Server">
	<a href='<%= ResolveUrl("~/Pages/Carrier/Trip.aspx") %>'>Вернуться к рейсам</a>
	<div style="width:100%;">
		<asp:Label runat="server" ID="lbMessage" />
		<asp:ValidationSummary ID="vsRouteSave" runat="server" ValidationGroup="vgSave" CssClass="ValidationSummary" />
	</div>
	<div class="edit-form">
		<asp:UpdatePanel runat="server" ID="upRouteBus" UpdateMode="Conditional">
			<ContentTemplate>
				<div class="edit-row">
					<div class="edit-label">Маршрут</div>
					<div class="edit-control">
						<asp:Label runat="server" ID="lbRouteName" />
						<asp:LinkButton runat="server" ID="lkbEditRoute" Text="[Изменить]" 
												OnClick="OnEditSearch" CommandName="Route" />
						<asp:HiddenField runat="server" ID="hfRouteID" />
					</div>
				</div>
				<div class="edit-row">
					<div class="edit-label">Автобус</div>
					<div class="edit-control">
						<asp:Label runat="server" ID="lbBusName" />
						<asp:LinkButton runat="server" ID="lkbEditBus" Text="[Изменить]" 
												OnClick="OnEditSearch" CommandName="Bus" />
						<asp:HiddenField runat="server" ID="hfBusID" />
					</div>
				</div>
			</ContentTemplate>
		</asp:UpdatePanel>
		<div class="edit-row">
			<div class="edit-label">Время отправления</div>
			<div class="edit-control">
				<asp:TextBox runat="server" ID="tbTripTime" />
				<ajax:MaskedEditExtender
					ID="meeTripTime" 
					runat="server" 
					TargetControlID="tbTripTime" 
					Mask="99:99"
					MessageValidatorTip="true" 
					MaskType="Time" 
					InputDirection="LeftToRight" 
					AcceptNegative="Left" 
					DisplayMoney="Left"
					ErrorTooltipEnabled="True"/>
				<ajax:MaskedEditValidator
					ID="mevTripTime" 
					runat="server" 
					ControlExtender="meeTripTime" 
					ControlToValidate="tbTripTime" 
					ErrorMessage="Неверный формат времени" 
					Text="*" 
					ValidationGroup="vgSave"
					MaximumValue="23:59" 
					IsValidEmpty="False" 
					EmptyValueMessage="Не указано время отправления" 
					InvalidValueMessage="Неверный формат времени" 
					MaximumValueMessage="Неверный формат времени" 
					MinimumValueMessage="Неверный формат времени" 
					MinimumValue="00:00" 
					EmptyValueBlurredText="*" 
					InvalidValueBlurredMessage="*" 
					MaximumValueBlurredMessage="*" 
					MinimumValueBlurredText="*"
					Display="Dynamic"/>
			</div>
		</div>
		<div class="edit-row">
			<div class="edit-label">Дата отправления</div>
			<div class="edit-control">
				<asp:TextBox runat="server" ID="tbTripDT" />
				<asp:CompareValidator ID="cvTripDT" runat="server" ControlToValidate="tbTripDT" Type="Date" Operator="DataTypeCheck"
									ErrorMessage="Неверный формат даты" Text="*" ValidationGroup="vgSave" Display="Dynamic" />
				<ajax:CalendarExtender ID="ceTripDT" runat="server" Format="dd.MM.yyyy" TargetControlID="tbTripDT" PopupButtonID="tbTripDT" />
			</div>
		</div>
	</div>
	<div class="buttons">
		<asp:Button runat="server" ID="btnSave" Text="Сохранить" OnClick="OnTripSave" ValidationGroup="vgSave" />
		<asp:Button runat="server" ID="btnCancel" Text="Отменить" OnClick="OnCancel" />
	</div>
	
	<div id="modal" runat="server" class="modaldiv" style="display:none;">
		<asp:UpdatePanel runat="server" ID="upSearch">
			<ContentTemplate>
				<asp:TextBox runat="server" ID="tbSearch" Width="250" AutoPostBack="true"
							OnTextChanged="OnSearch" />
				<asp:LinkButton runat="server" ID="lkbAddSearch" Text="Добавить"
								OnClick="OnAddSearch" />
				<br />
				<asp:Repeater runat="server" ID="rptSearch">
					<ItemTemplate>
						<asp:LinkButton runat="server" ID="lkbSearch" Text='<%# Eval("Name") %>'
										CommandArgument='<%# Eval("Id") %>' OnClick="OnApplySearch" />
					</ItemTemplate>
				</asp:Repeater>
				<asp:HiddenField runat="server" ID="hfModalAction" />
			</ContentTemplate>
		</asp:UpdatePanel>
		<div style="text-align: right;">
			<asp:Button runat="server" ID="btnModalClose" Text="Закрыть" />
		</div>
	</div>
	<asp:LinkButton Text="" runat="server" ID="lnkPopup" />
	<ajax:ModalPopupExtender ID="MPE" runat="server" PopupControlID="modal" TargetControlID="lnkPopup"
		CancelControlID="btnModalClose" BehaviorID="MPEbeh" BackgroundCssClass="ui-modal-overlay"
		OkControlID="btnModalClose" />
</asp:Content>

